#ifndef _IIOOPERATION_H_
#define _IIOOPERATION_H_


typedef ULONG ERROR_CODE;



#define 		OP_NULL				0x00
#define 		OP_WRITETIMEOUT		0x01
#define 		OP_READTIMEOUT		0x02
#define 		OP_WRITEERROR		0x04
#define 		OP_READERROR		0x08
#define 		OP_OPENERROR		0x10
#define 		OP_EXCEPTION		0x100
#define 		OP_EOF				0x200



interface IOperationEvent : public IBase
{
	std_method(OnComplete)(IBase *pOperation, event_id event, ULONG error_code) PURE;
};

// {0470327E-5ACF-40EC-BAED-FE2AAE877B4B}
_DEFINE_IID(IID_IOperationEvent,
	0x470327e, 0x5acf, 0x40ec, 0xba, 0xed, 0xfe, 0x2a, 0xae, 0x87, 0x7b, 0x4b);

interface IOperation : public IBase
{
	std_method(BindIBase)(IBase* pBase) PURE;
	std_method(UnBindIBase)() PURE;
	std_method(QueryIBaseIID)(REFIID riid, void **ppv) PURE;
	std_method(BindEvent)(IBase* pEvents) PURE;
	std_method(UnBindEvent)() PURE;
	std_method(SetId)(ULONG uId) PURE;
	std_method_(ULONG, GetId)() PURE;
	std_method(SetResult)(ERROR_CODE Error, BUFFER_SIZE uTransferedBytes) PURE;
	std_method(GetResult)(ERROR_CODE *Error, BUFFER_SIZE *pTransferedBytes) PURE;
	std_method(SetIoParam)(BUFFER_SIZE uStartPos, BUFFER_SIZE uExpectBytes) PURE;
	std_method(GetIoParam)(BUFFER_SIZE* uStartPos, BUFFER_SIZE* pExpectBytes) PURE;
	std_method(SetExpect)(BUFFER_SIZE uExpectBytes) PURE;
	std_method(GetExpect)(BUFFER_SIZE *pExpectBytes) PURE;
	std_method(SetPos)(BUFFER_SIZE uPos) PURE;
	std_method(GetPos)(BUFFER_SIZE *pPos) PURE;
	std_method(SetTransfered)(BUFFER_SIZE uTransferedBytes) PURE;
	std_method(GetTransfered)(BUFFER_SIZE *pTransferedBytes) PURE;
	std_method(Attach)(BUFFER_PTR Ptr, BUFFER_SIZE Pos, BUFFER_SIZE Size) PURE;
	std_method(Alloc)(BUFFER_SIZE Size) PURE;
	std_method(GetLen)(BUFFER_SIZE *Len) PURE;
	std_method(GetPtr)(BUFFER_PTR* Ptr) PURE;
	std_method(ReleasePtr)() PURE;
	std_method(ClearPtr)() PURE;
	std_method(Post)(ULONG event, ULONG error_code) PURE;
};

// {FEB12B33-7344-45CD-A375-2495C7BEBD88}
_DEFINE_IID(IID_IOperation,
	0xfeb12b33, 0x7344, 0x45cd, 0xa3, 0x75, 0x24, 0x95, 0xc7, 0xbe, 0xbd, 0x88);




#endif
